export default function (data, name = 'fileName', type = '.pdf') {
  const fs = wx.getFileSystemManager(); //获取全局唯一的文件管理器
  const fileName = name + '_' + new Date().getTime()
  const filePath = wx.env.USER_DATA_PATH + `/${fileName}` + type
  fs.writeFile({ // 写文件
    filePath: filePath,
    data: data,
    encoding: "binary", //二进制流文件必须是 binary
    success() {
      wx.openDocument({ // 打开文档
        filePath: filePath,
        showMenu: true, // 显示右上角菜单
        success: function (x) {
          console.log("successfun", x);
        },
      })
    }
  });
}